{% from 'include/provisioning/variables.html' import gcore_regions, do_regions, aws_regions, aws_oss, do_oss, aws_volume_type, gcore_volume_type %}
<div id="do_create" style="display: none; padding: 0 2px 0 0; margin-left: 1px; margin-right: -4px;">
    <table class="overview provisioning_table">
        {% include 'include/tr_validate_tips.html' %}
        <tr>
            <td colspan="2" class="headers">
                <b>General information</b>
            </td>
        </tr>
        <tr>
            <td class="padding20 padding-top20">
                Server name
                <span class="need-field">*</span>
            </td>
            <td>
                {{input('do_create_server_name', required='required', size='26')}}
                <div class="tooltip tooltipTop tooltipTd">The name must contain only URL safe characters, and no path separators</div>
            </td>
        </tr>
         {% if role == 1 %}
        <tr>
            <td class="padding20">
                Group
                <span class="need-field">*</span>
            </td>
            <td>
                <select id="do_create_group">
                {% for group in groups %}
					<option value="{{ group.group_id }}">{{ group.name }}</option>
                {% endfor %}
                </select>
            </td>
        </tr>
        {% else %}
            {{input('do_create_group', value=groups, type='hidden')}}
        {% endif %}
        <tr>
            <td class="padding20">
                Provider credentials
                <span class="need-field">*</span>
            </td>
            <td>
                <select id="do_create_provider">
                {% for p in providers %}
                    {% if p.2 == 'do' %}
					<option value="{{ p.0 }}">{{ p.1 }}</option>
                    {% endif %}
                {% endfor %}
                </select>
            </td>
        </tr>
        <tr>
            <td class="padding20 padding-top20">
                Region
                <span class="need-field">*</span>
            </td>
            <td>
                {{ select('do_create_regions', values=do_regions) }}
                <div class="tooltip tooltipTop tooltipTd">Not all regions may be active</div>
            </td>
        </tr>
        <tr>
            <td colspan="2" class="headers">
                <b>Instance</b>
            </td>
        </tr>
        <tr>
            <td class="padding20">
                Size
                <span class="need-field">*</span>
            </td>
            <td>
                <select id="do_create_size" required="required">
                    <optgroup label="Basic">
                        <option value="s-1vcpu-1gb">s-1vcpu-1gb</option>
                        <option value="s-1vcpu-2gb">s-1vcpu-2gb</option>
                        <option value="s-2vcpu-2gb">s-2vcpu-2gb</option>
                        <option value="s-2vcpu-4gb">s-2vcpu-4gb</option>
                        <option value="s-4vcpu-8gb">s-4vcpu-8gb</option>
                        <option value="s-8vcpu-16gb">s-8vcpu-16gb</option>
                    </optgroup>
                    <optgroup label="General     Purpose">
                        <option value="g-2vcpu-8gb">g-2vcpu-8gb</option>
                        <option value="g-4vcpu-16gb">g-4vcpu-16gb</option>
                        <option value="g-8vcpu-32gb">g-8vcpu-32gb</option>
                        <option value="g-16vcpu-64gb">g-16vcpu-64gb</option>
                        <option value="g-32vcpu-128gb">g-32vcpu-128gb</option>
                        <option value="g-40vcpu-160gb">g-40vcpu-160gb</option>
                    </optgroup>
                    <optgroup label="CPU-Optimized">
                        <option value="c-2-4gib">c-2-4gib</option>
                        <option value="c-4-8gib">c-4-8gib</option>
                        <option value="c-8-16gib">c-8-16gib</option>
                        <option value="c-16-32gib">c-16-32gib</option>
                        <option value="c-32-64gib">c-32-64gib</option>
                    </optgroup>
                    <optgroup label="Memory-Optimized">
                        <option value="m-2vcpu-16gb">m-2vcpu-16gb</option>
                        <option value="m-4vcpu-32gb">m-4vcpu-32gb</option>
                        <option value="m-8vcpu-64gb">m-8vcpu-64gb</option>
                        <option value="m-16vcpu-128gb">m-16vcpu-128gb</option>
                        <option value="m-24vcpu-192gb">m-24vcpu-192gb</option>
                        <option value="m-32vcpu-256gb">m-32vcpu-256gb</option>
                    </optgroup>
                </select>
                {{input('do_create_size_text', size='26', style='display: none')}}
                <a class="link" id="do-instance-enter">Enter manually</a>
                <a class="link" id="do-instance-enter-select" style="display: none; margin-left: 27px;">Change to select</a>
            </td>
        </tr>
        <tr>
            <td class="padding20">
                OS
                <span class="need-field">*</span>
            </td>
            <td>
                {{ select('do_create_oss', values=do_oss) }}
            </td>
        </tr>
        <tr>
            <td class="padding20">
                SSH
                <span class="need-field">*</span>
            </td>
            <td>
                <select id="do_create_ssh_choose">
                    <option value="none" disabled selected>Choose SSH</option>
                    <option value="ssh_name">Set SSH key name</option>
                    <option value="ssh_ids">Set SSH key ids</option>
                </select>
            </td>
        </tr>
        <tr id="do_create_ssh_ids_tr" style="display: none;">
            <td class="padding20 padding-top20"">
                SSH key ids
                <span class="need-field">*</span>
            </td>
            <td>
                {{input('do_create_ssh_ids', size='26')}}
                <div class="tooltip tooltipTop tooltipTd">List comma separated. Required if SSH key name is empty</div>
            </td>
        </tr>
        <tr id="do_create_ssh_name_tr" style="display: none;">
            <td class="padding20 padding-top20">
                SSH key name
                <span class="need-field">*</span>
            </td>
            <td>
                {{input('do_create_ssh_name', size='26')}}
                <div class="tooltip tooltipTop tooltipTd">Required if SSH key ids is empty</div>
            </td>
        </tr>
        <tr>
            <td class="padding20">Monitoring</td>
            <td>{{checkbox('do_create_monitoring', checked='checked')}}</td>
        </tr>
        <tr>
            <td class="padding20">Backup</td>
            <td>{{checkbox('do_create_backup')}}</td>
        </tr>
        <tr>
            <td colspan="2" class="headers">
                <b>Network</b>
            </td>
        </tr>
        <tr>
            <td class="padding20">Private IP</td>
            <td>{{checkbox('do_create_private_net', checked='checked')}}</td>
        </tr>
        <tr>
            <td class="padding20 padding-top20">Floating IP</td>
            <td>{{checkbox('do_create_floating_net')}}<div class="tooltip tooltipTop tooltipTd">If unchecked then will be used public IP</div></td>
        </tr>
        <tr>
            <td class="padding20" style="padding-bottom: 25px;padding-top: 25px;">Firewall</td>
            <td>
                {{checkbox('do_create_firewall', checked='checked')}}
                <div class="tooltip tooltipTop tooltipTd">Roxy-WI will create firewall and open 22, 443, 1999, 8085, 8086 ports. Otherwise all ports will be opened</div>
            </td>
        </tr>
    </table>
</div>
<div id="aws_create" style="display: none; padding: 0 2px 0 0; margin-left: 1px; margin-right: -4px;">
    <table class="overview provisioning_table">
        {% include 'include/tr_validate_tips.html' %}
        <tr>
            <td colspan="2" class="headers">
                <b>General information</b>
            </td>
        </tr>
        <tr>
            <td class="padding20 padding-top20">
                Server name
                <span class="need-field">*</span>
            </td>
            <td>
                {{input('aws_create_server_name', required='required', size='26')}}
                <div class="tooltip tooltipTop tooltipTd">The name must contain only URL safe characters, and no path separators</div>
            </td>
        </tr>
         {% if role == 1 %}
        <tr>
            <td class="padding20">
                Group
                <span class="need-field">*</span>
            </td>
            <td>
                <select id="aws_create_group">
                {% for group in groups %}
					<option value="{{ group.group_id }}">{{ group.name }}</option>
                {% endfor %}
                </select>
            </td>
        </tr>
        {% else %}
            {{input('aws_create_group', value=groups, type='hidden')}}
        {% endif %}
        <tr>
            <td class="padding20">
                Provider credentials
                <span class="need-field">*</span>
            </td>
            <td>
                <select id="aws_create_provider">
                {% for p in providers %}
                    {% if p.2 == 'aws' %}
					<option value="{{ p.0 }}">{{ p.1 }}</option>
                    {% endif %}
                {% endfor %}
                </select>
            </td>
        </tr>
        <tr>
            <td class="padding20 padding-top20">
                Region
                <span class="need-field">*</span>
            </td>
            <td>
                {{ select('aws_create_regions', values=aws_regions) }}
                <div class="tooltip tooltipTop tooltipTd">Not all regions may be active</div>
            </td>
        </tr>
        <tr>
            <td colspan="2" class="headers">
                <b>Instance</b>
            </td>
        </tr>
        <tr>
            <td class="padding20 padding-top20">
                Instance type
                <span class="need-field">*</span>
            </td>
            <td>
                {{input('aws_create_size', required='required', size='26')}}
                <div class="tooltip tooltipTop tooltipTd">
                    Instance types list is <a href="https://aws.amazon.com/ec2/instance-types/" title="Instance types list" target="_blank">here</a>
                </div>
            </td>
        </tr>
        <tr>
            <td class="padding20">
                OS
                <span class="need-field">*</span>
            </td>
            <td>
                {{ select('aws_create_oss', values=aws_oss) }}
            </td>
        </tr>
        <tr>
            <td class="padding20 padding-top20">
                SSH key pair name
                <span class="need-field">*</span>
            </td>
            <td>
                {{input('aws_create_ssh_name', size='26')}}
                <div class="tooltip tooltipTop tooltipTd">SSH key must exists in region where instance create</div>
            </td>
        </tr>
        <tr>
            <td colspan="2" class="headers">
                <b>Volume</b>
            </td>
        </tr>
        <tr>
            <td class="padding20">
                Volume size
                <span class="need-field">*</span>
            </td>
            <td>
                {{input('aws_create_volume_size', size='26', value='10', type='number')}}Gb
            </td>
        </tr>
        <tr>
            <td class="padding20">
                Volume type
                <span class="need-field">*</span>
            </td>
            <td>
                {{ select('aws_create_volume_type', values=aws_volume_type) }}
            </td>
        </tr>
        <tr>
            <td class="padding20 padding-top20">Delete on termination</td>
            <td>
                {{checkbox('aws_create_delete_on_termination', checked='checked')}}
                <div class="tooltip tooltipTop tooltipTd">Whether the volume should be destroyed on instance termination</div>
            </td>
        </tr>
        <tr>
            <td colspan="2" class="headers">
                <b>Network</b>
            </td>
        </tr>
        <tr>
            <td class="padding20">Public IP</td>
            <td>
                <select id="aws_create_public_ip">
                    <option value="public">Public IP</option>
                    <option value="elastic">Elastic IP</option>
                    <option value="none">None</option>
                </select>
            </td>
        </tr>
        <tr>
            <td class="padding20" style="padding-bottom: 25px;padding-top: 25px;">Firewall</td>
            <td>
                {{checkbox('aws_create_firewall', checked='checked')}}
                <div class="tooltip tooltipTop tooltipTd">Roxy-WI will create Security group and open 22, 443, 1999, 8085, 8086 ports. Otherwise all ports will be closed</div>
            </td>
        </tr>
    </table>
</div>
<div id="gcore_create" style="display: none; padding: 0 2px 0 0; margin-left: 1px; margin-right: -4px;">
    <table class="overview provisioning_table">
        {% include 'include/tr_validate_tips.html' %}
        <tr>
            <td colspan="2" class="headers">
                <b>General information</b>
            </td>
        </tr>
        <tr>
            <td class="padding20 padding-top20">
                Server name
                <span class="need-field">*</span>
            </td>
            <td>
                {{input('gcore_create_server_name', required='required', size='26')}}
                <div class="tooltip tooltipTop tooltipTd">The name must contain only URL safe characters, and no path separators</div>
            </td>
        </tr>
         {% if role == 1 %}
        <tr>
            <td class="padding20">
                Group
                <span class="need-field">*</span>
            </td>
            <td>
                <select id="gcore_create_group">
                {% for group in groups %}
					<option value="{{ group.group_id }}">{{ group.name }}</option>
                {% endfor %}
                </select>
            </td>
        </tr>
        {% else %}
            {{input('gcore_create_group', value=groups, type='hidden')}}
        {% endif %}
        <tr>
            <td class="padding20">
                Provider credentials
                <span class="need-field">*</span>
            </td>
            <td>
                <select id="gcore_create_provider">
                {% for p in providers %}
                    {% if p.2 == 'gcore' %}
					<option value="{{ p.0 }}">{{ p.1 }}</option>
                    {% endif %}
                {% endfor %}
                </select>
            </td>
        </tr>
        <tr>
            <td class="padding20">
                Region
                <span class="need-field">*</span>
            </td>
            <td>
                {{ select('gcore_create_regions', values=gcore_regions) }}
            </td>
        </tr>
        <tr>
            <td class="padding20">
                Project name
                <span class="need-field">*</span>
            </td>
            <td>
                {{input('gcore_create_project_name', size='26', value='default')}}
            </td>
        </tr>
        <tr>
            <td colspan="2" class="headers">
                <b>Instance</b>
            </td>
        </tr>
        <tr>
            <td class="padding20">
                Flavor
                <span class="need-field">*</span>
            </td>
            <td>
                <select id="gcore_create_size" required="required">
                    <optgroup label="Standard">
                        <option value="g1-standard-1-2">g1-standard-1-2</option>
                        <option value="g1-standard-2-4">g1-standard-2-4</option>
                        <option value="g1-standard-2-8">g1-standard-2-8</option>
                        <option value="g1-standard-4-8">g1-standard-4-8</option>
                        <option value="g1-standard-4-16">g1-standard-4-16</option>
                        <option value="g1-standard-8-16">g1-standard-8-16</option>
                        <option value="g1-standard-8-32">g1-standard-8-32</option>
                        <option value="g1-standard-16-32">g1-standard-16-32</option>
                        <option value="g1-standard-16-64">g1-standard-16-64</option>
                        <option value="g1-standard-32-64">g1-standard-32-64</option>
                        <option value="g1-standard-32-128">g1-standard-32-128</option>
                    </optgroup>
                    <optgroup label="vCPU">
                        <option value="g1-cpu-2-2">g1-cpu-2-2</option>
                        <option value="g1-cpu-4-4">g1-cpu-4-4</option>
                        <option value="g1-cpu-8-8">g1-cpu-8-8</option>
                        <option value="g1-cpu-16-16">g1-cpu-16-16</option>
                        <option value="g1-cpu-32-32">g1-cpu-32-32</option>
                    </optgroup>
                    <optgroup label="Memory">
                        <option value="g1-memory-2-16">g1-memory-2-16</option>
                        <option value="g1-memory-4-32">g1-memory-4-32</option>
                        <option value="g1-memory-8-64">g1-memory-8-64</option>
                        <option value="g1-memory-16-128">g1-memory-16-128</option>
                        <option value="g1-memory-32-256">g1-memory-32-256</option>
                    </optgroup>
                </select>
                {{input('gcore_create_size_text', size='26', style='display: none')}}
                <a class="link" id="gcore-instance-enter">Enter manually</a>
                <a class="link" id="gcore-instance-enter-select" style="display: none; margin-left: 27px;">Change to select</a>
            </td>
        </tr>
        <tr>
            <td class="padding20">
                OS
                <span class="need-field">*</span>
            </td>
            <td>
                {% set oss = dict() %}
                {% set oss = {'centos-7-gcore':'Centos 7'} %}
                {{ select('gcore_create_oss', values=oss) }}
            </td>
        </tr>
        <tr>
            <td class="padding20 padding-top20">
                SSH key pair name
                <span class="need-field">*</span>
            </td>
            <td>
                {{input('gcore_create_ssh_name', size='26')}}
                <div class="tooltip tooltipTop tooltipTd">SSH key must exists in region where instance create</div>
            </td>
        </tr>
        <tr>
            <td colspan="2" class="headers">
                <b>Volume</b>
            </td>
        </tr>
        <tr>
            <td class="padding20">
                Volume size
                <span class="need-field">*</span>
            </td>
            <td>
                {{input('gcore_create_volume_size', size='26', value='10', type='number')}}Gb
            </td>
        </tr>
        <tr>
            <td class="padding20">
                Volume type
                <span class="need-field">*</span>
            </td>
            <td>
                {{ select('gcore_create_volume_type', values=gcore_volume_type) }}
            </td>
        </tr>
        <tr>
            <td class="padding20 padding-top20">Delete on termination</td>
            <td>
                {{checkbox('gcore_create_delete_on_termination', checked='checked')}}
                <div class="tooltip tooltipTop tooltipTd">Whether the volume should be destroyed on instance termination</div>
            </td>
        </tr>
        <tr>
            <td colspan="2" class="headers">
                <b>Network</b>
            </td>
        </tr>
        <tr>
            <td class="padding20">Network Type</td>
            <td>
                <select id="gcore_create_network_type">
                    <option value="external">External IP</option>
                    <option value="any_subnet">Custom Network</option>
                </select>
            </td>
        </tr>
        <tr id="gcore_any_subnet" style="display: none">
            <td class="padding20">
                Network name
                <span class="need-field">*</span>
            </td>
            <td>{{input('gcore_create_network_name', size='26')}}</td>
        </tr>
        <tr>
            <td class="padding20" style="padding-bottom: 25px;padding-top: 25px;">Firewall</td>
            <td>
                {{checkbox('gcore_create_firewall', checked='checked')}}
                <div class="tooltip tooltipTop tooltipTd">Roxy-WI will create Security group and open 22, 443, 1999, 8085, 8086 ports. Otherwise will be used the default SG</div>
            </td>
        </tr>
    </table>
</div>
<div id="server_creating" style="display: none;">
    <ul style="padding: 20px 20px 0px 20px;font-size: 15px;">
        <li id="creating-init" class="server-creating">Creating environment...</li>
        <li id="creating-vars" class="server-creating">Creating vars...</li>
        <li id="creating-validate" class="server-creating">Validation...</li>
        <li id="creating-workspace" class="server-creating">Creating workspace...</li>
        <li id="creating-server" class="server-creating">Creating server...</li>
    </ul>
    <div id="wait-mess"></div>
    <div id="created-mess" class="alert alert-success" style="display:none;"></div>
    <div id="creating-error" class="alert alert-danger" style="display:none;"></div>
    <div class="progress-bar-striped">
        <div id="creating-progress" style="width: 0%;"></div>
    </div>
</div>
<div id="server_editing" style="display: none;">
    <ul style="padding: 20px 20px 0px 20px;font-size: 15px;">
        <li id="editing-init" class="server-creating">Updating environment...</li>
        <li id="editing-vars" class="server-creating">Updating vars...</li>
        <li id="editing-validate" class="server-creating">Validation...</li>
        <li id="editing-workspace" class="server-creating">Updating workspace...</li>
        <li id="editing-server" class="server-creating">Updating server...</li>
    </ul>
    <div id="editing-wait-mess"></div>
    <div id="edited-mess" class="alert alert-success" style="display:none;"></div>
    <div id="editing-error" class="alert alert-danger" style="display:none;"></div>
    <div class="progress-bar-striped">
        <div id="editing-progress" style="width: 0%;"></div>
    </div>
</div>